<template>
  <el-drawer
    title="订单详情"
    :visible.sync="showOrder"
    size="1000px"
    :wrapper-closable="!modalDialog"
  >
    <div class="property-title">订单信息</div>
    <div class="df_ac">
      <div>
        <span class="key">租赁单号：</span>
        <span class="value">{{ detail.id }}</span>
      </div>
      <div>
        <span class="key">支付状态：</span>
        <span class="value">{{ detail.payStatus === "0" ? "待支付" : detail.payStatus === "1" ? "超时未支付" : detail.payStatus === "2" ? "取消支付" : detail.payStatus === "3" ? "支付成功" : detail.payStatus === "4" ? "退款中" : detail.payStatus === "5" ? "退款成功" : "" }}
        </span>
      </div>
      <div v-if="detail.status">
        <span class="key">状态：</span>
        <span class="value"> {{ detail.status === "0" ? "租赁中" :detail.status === "1" ? "已归还" : detail.status === "2" ? "待支付" :detail.status === "3" ? "取消支付": "" }}</span>
      </div>
      <div>
        <span class="key">租赁时间：</span>
        <span class="value">{{ detail.leaseTime }}</span>
      </div>
      <div>
        <span class="key">订单金额：</span>
        <span class="value">{{ detail.orderPrice }}</span>
      </div>
      <div>
        <span class="key">支付方式：</span>
        <span class="value">{{ detail.payMethodName || '~' }}</span>
      </div>
      <div>
        <span class="key">完成时间：</span>
        <span class="value">{{ detail.backTime || '~' }}</span>
      </div>
      <div>
        <span class="key">租赁人类型：</span>
        <span class="value">{{ detail.leaseUserType == 1 ? '会员' : '散客' }}</span>
      </div>
      <div>
        <span class="key">已退款：</span>
        <span class="value">{{ detail.backPrice || '~' }}</span>
      </div>
      <div v-if="detail.mixedPayMethod" class="item">
        <span class="key">混合支付方式：</span>
        <span class="value">{{ detail.mixedPayMethod || '-' }}</span>
      </div>
      <div v-if="detail.mixedPayMoney" class="item">
        <span class="key">混合支付金额：</span>
        <span class="value">{{ detail.mixedPayMoney || '-' }}</span>
      </div>
      <div v-if="detail.cardPayMoney" class="item">
        <span class="key">混合支付会员卡金额：</span>
        <span class="value">{{ detail.cardPayMoney || '-' }}</span>
      </div>
      <div>
        <span class="key">备注：</span>
        <span class="value">{{ detail.remark || '~' }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">开票情况</div>
    <div class="df_ac">
      <div>
        <span class="key">开票状态：</span>
        <span class="value">{{ detail.invoiceStatus== '1'?"已开":"未开取" }}</span>
      </div>
      <div>
        <span class="key">开票时间：</span>
        <span class="value">{{ detail.invoiceTime || "~" }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">买家信息</div>
    <div class="df_ac">
      <div>
        <span class="key">姓名：</span>
        <span class="value">{{ detail.leaseUserName }}</span>
      </div>
      <div>
        <span class="key">联系电话：</span>
        <span class="value">{{ detail.leaseUserPhone || "~" }}</span>
      </div>
      <div v-if="detail.cardNo">
        <span class="key">会员卡号：</span>
        <span class="value">{{ detail.cardNo || "~" }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">器材租赁信息</div>
    <el-table
      ref="multipleTable"
      :data="detail.equipmentLeaseInfo"
      border
      fit
      :header-row-class-name="'table-header'"
      class="doumee-element-table"
    >
      <el-table-column
        align="center"
        label="器材名称"
        prop="equipmentName"
        show-overflow-tooltip
        min-width="120"
      />

      <el-table-column
        align="center"
        label="支付押金"
        show-overflow-tooltip
        prop="realDeposit"
        min-width="80"
      />
      <el-table-column
        label="租赁时间"
        prop="leaseTime"
        min-width="160"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column
        label="免费时长(分钟)"
        prop="freeTime"
        show-overflow-tooltip
        min-width="110"
        align="center"
      >
        <template slot-scope="scope">
          {{ scope.row.freeTime || 0 }}
        </template></el-table-column>
      <el-table-column
        label="租赁时长(分钟)"
        prop="leaseTimeNum"
        show-overflow-tooltip
        min-width="110"
        align="center"
      />
      <el-table-column
        label="租赁费用"
        prop="leasePrice"
        show-overflow-tooltip
        min-width="80"
        align="center"
      />
      <el-table-column
        label="退还押金"
        prop="backDeposit"
        show-overflow-tooltip
        min-width="80"
        align="center"
      />
      <el-table-column
        label="收费标准"
        prop="chargeInfo"
        show-overflow-tooltip
        min-width="140"
        align="center"
      />
      <el-table-column
        label="归还时间"
        prop="backTime"
        min-width="160"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column
        label="租赁操作人"
        prop="leaseHandleUserName"
        min-width="110"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column
        label="归还操作人"
        prop="backHandleUserName"
        min-width="110"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column
        label="备注"
        prop="remark"
        min-width="120"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column
        label="状态"
        prop="status"
        min-width="80"
        show-overflow-tooltip
        align="center"
      >
        <template slot-scope="scope">
          {{ scope.row.status === "0" ? "租赁中" :scope.row.status === "1" ? "已归还" : scope.row.status === "2" ? "待支付" :scope.row.status === "3" ? "取消支付": "" }}
        </template>
      </el-table-column>
    </el-table>
    <div class="bottom_wrap">
      <div class="line">
        <span>订单金额：</span>
        <span>{{ detail.orderPrice }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.realPrice" class="line secondColor">
        <span>实收款：</span>
        <span>{{ detail.realPrice }}</span>
        <span>元</span>
      </div>
    </div>
  </el-drawer>
  <!--</div> -->
</template>

<script>
import { equipmentLeaseDetail } from '@/api'
import store from '@/store'
export default {
  name: 'OrderDetail',
  data() {
    return {
      detail: {},
      modalDialog: store.getters.dialog,
      showOrder: false // 弹窗
    }
  },
  methods: {
    goBack() {
      this.$router.replace('/ticket/ticketOrder')
    },
    getOrderDetail(id) {
      equipmentLeaseDetail({ param: { id }}).then((res) => {
        if (res.errorCode === '000000') {
          this.showOrder = true
          this.detail = res.record
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>

.df_ac {
  flex-wrap: wrap;
  div {
    width: 33.33%;
    margin-bottom: 20px;
    .key {
  color: #666666;
  display: inline-block;
  // width: 90px;
  // text-align: right;
}
.value {
  color: #222;
}
  }
}
.bottom_wrap {
  margin-top: 30px;
  text-align: right;
  .line {
    margin-bottom: 10px;
  }
}
</style>
